Some code refactoring done. Readme updated.