provided a lot of minor fixes and performance improvements