added function descriptions and some cleanup