factor out config and only require if needed