a bit refactored
working on site and manual: null-safe