minor refactoring and ui tweaks