fixed some style, moved rules specific code into the rules class
fixed styling errors