Code cleanup and ui clean up