Added documentation to function