modified by roccotam 4th attempt