Refactor out the boilerplate generator so it can be used from tool

doesn't work yet though
Extract the Boilerplate generating code into a separate package