major refactoring and better help messages