another implementation for query data for main page