Bug fixes and powerpc support

Hello Jorgen,

As long promised, here is my pull request for supporting IBM Power hardware, as well as a litany of bugfixes.

Thanks,
Nish