read code and added a few coments