Added more documentation to functions.