Define primitive helper functions