playing with gmra lda code to test and port to mauro versions