cleaned and commented first 6