write calls inside control function, math kept separate