AG-3549: manager
AG-3549: refactor types
AG-3549: tests first