refactor code - focus null and empty str