partial code cleanup