Code cleanup, esp in interface where lots of last-minute hacks were made