Throw away output from cd command
Refactoring a little bit
Fix issue in case CDPATH is being used.

Closes #178