moved write to storebase and some type cleanup