updated for code generation
updated to not call functions during execution of rules