Adding better error checking on API input parameters