Updated license header and performed some small refactoring.