move game initialization to function