Code cleanup, WIP