improve formatting, remove duplicate query