Refactor feed generation