Begin refactoring

While still not done made some progress on cleaning things up

* use logging module
* moved things into packages
* dropped the git version getting madness
* raise exception instead of setting an is_error
* minimum python version is v2.6 (using `with` and removed the check on
  json import which was needed in 2.5)