Rules remake. Fix #379