calculate total difficulty, and reorganized modules
cleaned up recalculation code