more general bug fixes, and code clean up. Added initial stubs for removal of rules