proper error handling and option parsing