works for local and remote