cleaned new config functions. Removed memory leak