the perfect blend of Simon and Lasse T's updates

Both have been modifying in the same script at the same time, which
created errors. Now both code snippets has been collected and
co-operates nicely. and from 3 - 35