create two helper functions