Can this be pulled into a separate function?