! unused globals, missing docs and wrong variables fixed

Signed-off-by: Spuds <spuds@spudsdesign.com>