Added readme. Refactored some code.