added getLM - to be called by matlab