Broke out nest and matrix functions