Moved loading settings inside the function