Rearraged files and added onRemove handler to dispose tabs that are closed. TODO: scripts.