Fixing ambiguous variable names and changing void ptrs to their correct type (where approriate)