Added documentation to functions