moved ui code to proper location