Changes from svn.
Minor refactoring.