fixed memory corruption when switching from GameplayScene, also modernized some of the code with C++11 features