Newest version from google code, plus bugfixes