eliminated more N+1 queries; minor tweaks