[TASK] Refactoring and unit test coverage increase

Do not merge before https://github.com/FluidTYPO3/flux/pull/247. Will require rebase.