Several enhancements, performance improvements and bugs fixed