added code removed during merge. Refactored a little.
Merge pull request #197 from CalvinFernandez/fix-merged-deletions

added code removed during merge. Refactored a little.