The present invention relates to novel compounds and method for the manufacture of inhibitors of deubiquitylating enzymes (DUBs). In particular, the invention relates to the inhibition of ubiquitin C-terminal hydrolase 30 (USP30). The invention further relates to the use of DUB inhibitors in the treatment of conditions involving mitochondrial dysfunction and cancer. Compounds of the invention include compounds having the formula (II) or a pharmaceutically acceptable salt thereof, wherein R1, R2, R3, R4, R5, R8, R9, R10, R12, Z, Y and m are as defined herein.