Added handling for TERM
Added cds function (moved from external executable)