Define functions.