Made it a function call instead of copy paste