Refactor configuration script