Refactor some decider code