Finished the new function