redesigned UI javascript (nearly working)