Added some wrapper functions to make parallelisation easier.