Documentation and clean up

Added documentation to new code and did a bit of clean up.
Added missing license information

Pasted license information to files that didn't have it yet.