the code is working and commented