changed 4 back to Shannon's version, added rownum restriction