Refactor fetching settings and merge later. Added test