Tidies up statement controller and fixes issues.