Moved the function to the top.