Simplify error handling by using q promises everywhere