added passgen function