added some commments in code