Started adding the main logic