Fixes on the last big code refactory
Some cosmetic changes. Must continue working at home.