A Computational Model of Dual Competition between the Basal Ganglia and the Cortex