Helper function to help deal with the Pyramid of Doom