Fixed memory leak issue

Major change to game architecture