Added lots of code to use master controller