Some refactoring
Reformat