Massive refactor, moved median to inside RecordingTask