Improvements to the activity rendering algorythm