added ability to update a contact and some refactoring