clean up code, remove cfg type