reorganization, better error handling, better help messages