fixed copy paste errors and added more comments