implement mod, equal and while