refactor and fixed issue with query limits