After many small tweaks a refactoring is needed and started