I was in a program for sexually deviant teens. Some things I learned were:
Fantasies are what can actually make masturbation harmful
There are such things as appropriate fantasies
Same age or within two years or both over 18
Same intelligence (maturity? wisdom? You pick.)
Consent is in...