A bit of simplification
A bit more refactoring to a manageable size