Refactor the background script and move event object to separate file
Move analytics into a separate class