added more documentation on functions