Feed javascript refactored