refined UI and code