A new function
Updated to make it a little more prettier.