config cleanup and smarter lib script