moving the cd() function into the common file