Some type refactoring, added config related error handling