added gameplay and main function