We consider perturbations of moderately degenerate integrable or partially integrable Hamiltonian systems, so that unperturbed invariant n-tori with prescribed frequencies or frequency ratios do not persist, but there is preservation of, say, the first d < n frequencies or their ratios. Lagrangian and lower dimensional tori are treated in a unified way. The proofs are very simple and follow Herman's idea of 1990: we introduce external parameters to remove degeneracies and then eliminate these parameters making use of a suitable number-theoretical lemma concerning Diophantine approximations of dependent quantities. Parallel results for reversible, volume preserving and dissipative systems are also presented.