move debug functions, add more to listener.py