cleanup and remove null check