Introduced removeNulls method for clarity, removal of duplication.