refactored code and edited README