Fixed up some issues. Now works like it did before, but with support for 16-bit data.