first version of lmt_saveroutine