Removed mutable variables in GenericBuilder and used Array instead of List