Refactor configuration load.
Remove all global variables