Move this to a function?