Finished the top level function definitions