Rewrite codebase in go