Code cleaned and commented