Make global refactoring, also read credentials from file