reduce nesting of utility functions