Added error handling and associated tests for missing parameters