Moved some more utility / helper function type code from the loc adapgter base class into separate util module, and added some unit tests to test this code.