Cleanup and reimplement some events properly.