added default limit of 50 to queries for safety
refactored out common service code