Refactoring and code cleanup
Updated readme