Fixed a bug for removing/overwriting contacts.
Cleaned up code from changes. Adding/removing is done neatly in functions.