added caching, replaced this with a variable