Refactored to make in-memory implementation completely client-side