modified controller to take dict and json for now.