refactor configuration handler