code cleanup and further UI improvements