updated coding and comments