Some modifications/optimizations