Enhanced config, added function

This version is untested.