Refactored generator to handle mutlilpe sites