Remove some includes from the headers
Start actually using weak_pointers in some places; additional uses currently lead to segfaults that I still can't explain
Remove ifdef
Remove some debugging code
Add missing fclose