Created a main logic.