Tidy code and add calc function