general build and refactor