readded struct checking for read/write