Implement some v4 support and fix bugs

Closes #19 #24 #25 #26 #27 #28

I think this is ready for a release. It may need some tests.