Error handling and tests...