rules, solve, and some bugs