added void* casts to stop the compiler from complaining