Implement ex. 5.5
Fixed rules.