Improve ubuntu support

As already discussed in #6, I rebased my clone and re-did the remaining changes from #6 on top of it.