now with fewer null checks