maybe making those variables part of the function?