Adds listener registration

Not tested yet, however, I am quite confident it works.