light refactor of ixputil.js