Cleaned up the contact map implementation so that it can be used to track the state of the system