Correct an error and optimise a bit.