Moved world-opening logic out of the command function.