added doctoring to function