improved mock for testing