refactor code to prepare RSS generation