Bug fixed + unit tests

index is update on patient update.
start working on unit tests