Refactored code to move FrameManager into model.