refactor the code. made some UX design changes