code cleanup and first crack at nextdiff