Fixed various styling errors and added some javadoc.