more thorough replace + new variable

-added private value 'isPositiveOrZero' to class

-changed all instances of T to int