Some more half support

Some of the commits in this request should resolve #44, I haven't thoroughly tested them though.
There are other miscellaneous clean-ups and improvements.