Rewrite of codebase