Remove Body Classes

One (untested) suggestion is to replace:

unset( $classes[array_search($body_classes, $classes)] );

with

$classes = array_diff( $classes, wp_parse_slug_list( $body_classes ) );

assuming the classes survive sanitize_title from wp_parse_slug_list(). It should also be alright with empty arrays.

We also note that wp_parse_slug_list() is using wp_parse_list() to parse the comma separated string.