Added test for controller, and did related changes.