build with and refactor to work with boot 2