cleaned and commented -fmd