refactor and implement some UI features