code adjusted and some rules missing are added