mainLogic