Issue16nib support

This is ziryanov's patch from issue #16 reformatted as a pull request for simpler integration. I reviewed the code and it looks fine to me, but I did not actually test with IB.