Added checking for event loops + draft of unused

Checking for event loops works pretty well
Checking for unused objects fails miserably, thinks all are unused...
Also falls into an infinite loop sometimes