changed cd function