refactor querys on homepage