two helper functions, and documentation