Converted to use SDK rather than plain old AJAX calls.