cleanup and attempt to support switching to v5 and back