Tracking attribute changes

Rebased version of #352