added plugins setup, added a bunch of logic for actions and decisions.