Added code from the svn repo