added rules and also some fixed bugs