Added applistener; closes #217.