main part of code