refactored to use prototype for game