Error corrected: if/else inverted.
The resources table is now updated when it's modified.