adding read function