simpler and cleaner null-check implementation