ver 1.04 code from Jul 2010