optimize colision loop