An anonymous inner class can further simplify the code.