Added controller error handling