moved vars so they're only created once during program run