ported logic for muscle contraction capability from latest C++