Improve docs funcion and macro