generic helper functions in go