Code cleanup for null checks