Switch to resource guards instead of just returning