added few rules and clean up a bit