Rever pull request from Nikita Nerkar. The code does not pass unit tests.