Further modularization of functions, such that more calculations can be made