updated some controller code, added some comments