now handles errors when not all required parameters are passed