Move this to the top of the function?