Fixed ruby warnings (ruby -w ...)
Mostly removed dead code