Incorported Octavi Fors' mods to make a callable function.