Move generator to a separate file