Implemented clever performance optimization