Add function definitions and calls