added more comments, and fixed spacing