misc cleanup/optimization