Move JS code to lib/ directory.