modified and commented