explained each line with comment