tweaked getTop query