Add Apache file headers
Clean up source
Enable Travis CI build
Fix Checkstyle warnings
Remove duplicate code
Fix whitespace and formatting