Minor streamlining of some functions