Added new function-testing code that is completely cross-browser compatible.