using mod d in the class instead