Initial contribution.
This is just the version of mid 2012, didn't try to build or test it yet.