modified so that input and output vocabularies are separate