partial refactoring of SQL results' rendering