fix deprecation warning

Second try not using static methods and instead moving everything into
the listener class.