refactor code and readme updates