Optimizing performance speeding up simulations and reducing errors