Move utility functions to utils.go