Trunk 3289a

Clean up code. 
Javadoc.