Reorgantize code