Some fixes and unit tests

Signed-off-by: Walker Crouse <walkercrouse@hotmail.com>