tools.h: Some cleanups