Fixed incorrect parameter name
Removed sleeps from tests
Refactored error handling for clarity