add utility functions and descriptive comments