Added non interactive mode and cleaned up hook execution logic so that hooks always get run based on priority.