Fix function signatures

Changed from void* types to type-aware handle types for the few
functions I forgot to fix earlier. Also added with statements
to several functions for future development.