Using Arel syntax for fetching entries

Improved query syntax