a little optimisation here and there