Fixed flag (and flag count)  deletion when node is deleted

This includes the following:
- Fixed incrementing/decrementing and creation/deletion of the flag_counts table.
- Fixed deletion of flaggings (and it's counts) when node is deleted.
- Cleaned up a little bit