Refactor building. Add dependencies field to package.json