first version with data in memory