remove unneccesary copying
perform mainloopgeneration under the hood