proper attach module integration and cleanup