restructured and tested controllers