minor changes and performance improvements