factor out getData.
Factor out path parsing and switch path scheme.