add count method.
allow using callable config.