change dir structure and related codes