Split viewer and editor into separate main files