writes and retrieves data successfuly, implements performance optimizations