Adding ui enhancements, also cleaning up code a bit