Took variables out of function