Moved the config file check to a function.
Fixed a small typeo