Made into a function.