Bug fixes + progress on unit tests

Signed-off-by: David Noble <dnoble@splunk.com>