[BF] Missing alias added to query builder; some simplified code; tabs converted to spaces