Simple template functions and utils