extract local.js and add test case for it.
mass cleanup: extract skel, stub and local impl