- Fix buffer overrun
	- Clean up code

Signed-off-by: Gleb Aronsky <gleb.aronsky@lexisnexis.com>