moving some utility functions into icejs