adding main logic