Mostly reorganized ui code.
We don't need this code anymore.