adds more sophisticated account calculation