misc code cleanup