refactor: cleanup null checks and helpers