Nice formatting thanks to costa
More updates to calculate function