Same comment as above. Consider making a _remove_empty_keys() sort of method on this class that does this cleaning process...good ol' DRY.