Moved ui code to a separate ui module