optimized: added cache and shrank bitmap