Added a license, fixed some bugs.