finished first part of the readonly version