Lots of various improvements

Major change, moved controller to it's own file