separating arithmetic into engine.js