Refactored out null checks