added resource management
added loading to game loop