initial working version, moves are very long