dep hat() and better unit management