useful functions for writing functions