refactored to get remote apis