Move API calls to their own methods, add method comments.