Bug fix in controller and a few modifications.