More opt types

Clean up code structure and Add pre and post action for every command run.