Working version of q3.cpp

Had to be modified by hand.
As it turns out, the issue I mentioned in the last commit message causes
more problems than I previously thought.

Invalid std::moves are occuring in multiple places