add license and restructure/cleanup a bit