Added license
Fixed couple of small bugs