Added comments, freed memory