intermidiate commit
first optimized implementation of recalculation