Fixed issue with refresh
Refactoring