UI form implemented, code refactored. fixes #1