Start moving functions out of rules