#refactor UI code