Added some constants.
Refactored some things.
Added license.