improve type-stability
refactor config parsing code