few improvements, can read config by filepath in first argument