Some refactoring

Not much more than simple refactoring