added movement correction (still some minor bugs)