refactored and added a few nice UX features