reconstruct codes, implemented the function of launching game