Fixed index refresh issue.

Fixed source/target switch on entity rebuild

Added performance comments as encountered