Fixed crashes when rotating the device.

Also made huge changes to how components are passed around.