Implemented some unit tests and fixed bugs in the location implementation