refactor attachment module