Some more ui implementation and code clean up