Added singularize() function to ApplicationController

Added the singularize() function to ApplicationController, because the
same exact code was used twice; this is to minimize repeating myself.