Move generic functions to the bottom of the file