Refactored to (attempt) to split out mod operation from memcopy
operation. Presently not functionling (I think it's reading more bytes
when empty, which is bad), so I'm looking into what the bug in the logic
is. However, I wanted to commit to make sure I didn't lose my changes.
Found the bug. Apparently checking if the buffer is empty AFTER trying
to read is insufficient. Anyway, moved the code back to the top of the
loop (really, I only moved it down because I thought it looked nicer
there), and things are working. Also looks like I shaved a second! Whee!