added some performance improvements