refactored code and polished the UX a little bit