Fixing move algorithm. Work in progress.