Improvements to event handling and removed dead code
Added tests for parseResponse, small code improvements
Small code fixes, more tests.