And this is why it should have been a function