small refactoring
- removes some duplications
- minor changes