Fixed controller deadlock and added some comments