Refactored and added javadocs to all nontest files