finish attachment refactor