add option flags and basic error handling