Add license, fix a few bugs, add sample project