Major refactoring, some features missing now

Tight coupling resolved, more events used, a few weird bugs introduced.