Higher-order functions for easier error handling