Add validation function to util.go