improvements to defining functions