refactor with helper check