did some cleanup and added a listener class