Cleaned up the implementation.
Merged master
Added a license