Rewrote configuration to be more flexible.