utility functions for handling code complexity