code optimization
caching fixes/optimization