Function 'ds.isValid' added and call to 'cat()' replaced by call to 'message()' in couple of functions.