some optimalizations