tweaked sp segment and encoding