refactor: reduce duplication, and use nullsafe when relevant
refactor: reduce duplication, and use nullsafe when relevant

weierophinney/mwop.net,weierophinney/mwop.net,weierophinney/mwop.net,weierophinney/mwop.net