Fix broken eventlisten and small refactor.

Here you go, @UtahDave