Added transactional support and almost done cache creation.