remove casting of void*, compile with -Wall, remove unused variables