two solutions added. the one from 9Z is very smart.