Remove indirect dependencies and obsolete dependencies