Add documentation for gray function