Fixed operations and added rule class.