Some refactorings

I didn't check the test suite for now as it's only a stylistic changes.