Refactor read-config and remove unneeded code.