Fixed issue with proper rights
Refactored SQL queries