Refactor some code to put more items in config