Mpi trap

This is ready for review