Mental impairment and legal incompetency