reduced Trapdoor code by a few lines