Patch pushed as c88de9648760797453e2d1f89479cdffffc18322 with some modifications. Thanks.