a bit refactoring after meeting with Patrik