Made variables consistently unsigned long int.