Various pegasusq optimizations