refactored some computations