Added elements swaping
Fixed wrong index identifications
fixed: wrong index identifications