hacking at pattern for error handling.