this is the main part of the code