Extreme night refactoring. May broke a lot.