ui code cleanup and fixed styles related to selected event