add and read from file working correctly