implement cd
implement cd
refactoring, reformat code