Merged Charly´s new code