Turned it into a function. It works