Improved gby and hj