Adapting code to work with Chrome's Ripple Emulator