more refatoring. most of the manager tests pass