added comments, brushed up code, added check for controller in controller.py