Incorporated changes from Dario.