added master controller, improved session handling