done main logic