re organize codes