changed table storage code to a function