added gamelogic code