Make use of calc and remove unused functions.