Major refactoring, and example using bouncy