Added dirty tracking, fixes issue 10