config and init refactor