#488 Several refactorings in apiv2