Modified code structure. Locks now functioning. Intermediate-adding diff support