made some performance improvements