New change-tracking functionality

Added new change-tracking functionality for much faster change
-tracking. Some refactorings in rest.