UI update, touch events update, code cleanup with some extra functions