Refresh code updated and refactored