add key_pattern option and change specification