Add limit to SQL query
Refactor test