Added trace visualisation. Fixed bugs in model