Refactoring

Optimizations