Added several type casts and changed many types - mostly from int to zint.