reduces number of db queries