Redo organization of code