Optimization & fixes