Use local variables in the cd functions to avoid polluting the global namespace. Also make the extended the cd function the default.