refactor: using helper instead of manual function check