refactored to remove dependency on appscale-tools