Adding changes for configuration options and cleaning up code