Modularize test.js
Factor log out of safety.js
Clean up test.js, safety.js