Stricter types
Removed C99isms
Clearer code for catching invalid pointers