This patch addresses all previous issues and I think it's ready to merge. Signed-off-by: Russell Coker <russell@coker.com.au>