doing function checkingFor2opt