added code from svn