Moved some code out of unittest.js into separate files