Put ui object to good use, improving readability
more implementation of previous commit