Cleanup scatter code