Modify the code and tests based on the new schema changes and fix get nearby contacts bug