changed cd from void to int in order to check status