Is an anonymous function required here? Should be able to just use checkMode.