made formatting response more intelligent