moved things around a bit; fewer database hits