Add doMove function and some fixes