cleanup horrible code