golfed the remove_symbol function