functions written and commented