Added some error handling for calling from the commandline. Just pushing before group meeting.