Refactored script package and added javadoc comments into dom package.