Major code cleanups, more to come...