move code from model to the manager