Refactor build and packaging

is this ready?