modify method now accepts classes instead of instances