Large rework of rowsecurity.c and other adjustments