Added a little error handling.