Separated UI code and improved UI