added Marco's code