working out issues in calculations