Shuffleing code around. This is Broken.
Finished some major refactoring of ui code.