generateCode Handler