Some optimizations and tunnings... WIP