small refactoring to avoid repeat calculation of prevMove