Some new code from Edgardo