Patch pushed as ecaada08ea555310c3d7c3aef868cbb42c25a62d with a few modifications. Thanks.