First nicely working version, new data detection should be checked