refactored ui listeners a little bit