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
Will push an updated version of this soon, including db_merge() instead of this condition below. Please don't merge yet ;-)