Massive refactor, encapsulated actions and q values into states