Optimisation

Code correction to reduce calculation times