A lot of refactoring and cleaning up. Also support for releases