Refactoring and don't save null valued vars