Progress on MaxMove function. Also deleted a bunch of my old ugly code.