Refactor into reusable pieces
release 0.8.0