adding code from SVN evolusPencil repository