added modulus.  changed some methods to use map for cleaner code