added more comments everywhere