add readme and refactor code