More cleanup and wrap twister generation with function.