Restructured code

Put UI functionality inside var, moved converter in a var