fixed modulo operator
simplified