Merging with joao's stuff