Added implementation for subpath in js