main logic file