These should be moved at the top of the function.