fix formatting, clean up imports, add missing license headers