 
 _build_errors = (mock) ->
   errors = ""
-  for signature in mock.signatures when signature.called == false
+  for signature in _signatures(mock) when signature.called == false
     errors += "'#{signature.method_name}(#{signature.args})' was never called\n"
   errors
     
 _start_new_signature = (mock, method_name) ->
-  mock.signatures.unshift( new MethodSignature(method_name) )     # .unshift pushes to front of array
+  _signatures(mock).unshift( new MethodSignature(method_name) )     # .unshift pushes to front of array
 
 _add_method_to_mock = (mock, method_name) ->
   mock[ method_name ] ?= _build_mocked_method(mock, method_name)

# Private Mock 'methods'; making them functions keeps the Mock object uncluttered.
#

_set_state = (mock, state) ->
  mock.state = state



_check_for_duplicate_signatures = (mock) ->
  # TODO: use each with index and slice to avoid last element
  signatures = _signatures(mock)
  return if signatures.length < 2
  for outer in [0..signatures.length-2]
    for inner in [outer+1..signatures.length-1]
      _throw_duplicate_expectation("#{signatures[outer].method_name}(#{signatures[outer].args})") if signatures[outer].equals( signatures[inner] )

_current_signature = (mock) ->
  _signatures(mock)[0]

_current_method_name = (mock) ->
  _current_signature(mock)?.method_name

_find_signature = (mock, method_name, args...) ->
  for signature in _signatures(mock) when signature.matches(method_name, args...)
    return signature
  undefined

