Multiple bits 'n pieces.

I cleaned up some your scala code; got rid of a lot of vars (might reduce performance slightly but should make the code more functional and easier to audit.  I got rid of 1000 odd lines of java Base64 encoder / decoder in favour of a simple 30 odd line scala encoder.  I also merged some work done downstream of me.