Refactored for refreshing functionality.
Fixing memory issues.