Added check for remote revision
Tests for adding remote revision and locks
Code refactoring