refactor upgrade