Changes to cd function.