Move code into codebase from views