Refactored database call for top submissions