defrag code optimization