license

Added license and cleaned up some code.