Bug fixes

• Performance enhancements
• Refactoring