code clean up
adding license and some comments