Updated license. Added documentation. Removed dead code