Cleans up various common function definitions and comments