using check function instead of factory