cleaned up code, added license