Added caching for user avatar, refactoring