Finished rewrite to Go