Whoops I also implemented this code last night.  Picking mine to remove boolean param in favor of two methods.  This version also raises if class param passed in is not an Application (was only checking instance path before)