Misc cleaning up here and there. Note that since the ids were used
to detect if an image still exists, some things may, for now, access freed images and break. This will be fixed once proper destroy handlers are added.
Showing with 142 additions and 414 deletions