Added unit tests for commonjs_bridge. Refactored code with nicer variable names.