finisched moving algoritm, sintax checking needed.