Popup ui and refactor of eventjs