refactor configuration handling