Added multi-gen function.