addition of er visit count and other modifications