sorted out conditionals in summing up at end of script