remove pointless tests
change some structures/typedefs/unions