Cleanup
Improves performance a bit (unaligned accesses, unnecessary casting in tight loops, unnecessary copies, etc.), ports away from useless custom structs, fixes a memory leak and ports away from some deprecated API.
Edited by Martin Tobias Holmedahl Sandsmark