[WIP] Some cleanup of code

This is not tested change, it's more like idea without cover in reality :panda_face: 

Some important changes:
- type-hint objects when possible,
- don't use container parameter in constructor
- reduce usage of container
- remove some code duplication
- made configuration a bit more readable