first blush at refactoring to use curl