mostly fixed view; added sql