Fleshed out error handling.