Updated logic and added Exception messages when an incorrect configuration is used.