updated optimal move, better naming conventions