avoid unnecessary calculations to speed up