Cleaned up containsKey method