add cmd line options and more error handling