Refactored code
Added documentation in README