Added readme file and refactored some code