refactor and UI tweaks