added changes proposed by Pau