We should investigate how to make this faster, especially the chance of compiling functions in parallel.