Various cleanups of function definitions