re-coded main fragment