Added function documentation
Fixed function declaration