Some fixes, better license and math.h