finish the mda loop and now debugging. moving towards snap function