added ideas for rules, tested in prolog.