Rewrite in Go