refactored some codes from monitor to manager