minor refactoring and added docs
fixed precondition
Merge pull request #3 from paliwalashish/master

minor refactoring and added docs