Refactored and added one feature

Sorry, i was unable to finish