Move generator to library