small additions to function