Restructure couch.go for better readability