Modification to the STL to AMF algorithm