Commented functions

Added more verbose function comments to the functions, main and
renderpages scripts