added controller and some fixes in core