Reduce dimension to speed up
Refactoring