First cut at trying to get JavaScript implementation working