nice guard clause and use of params hash in API call