first working version handling new format