First stab at entire codebase. Completely untested