Using 'assert' node module where appropriate

Thanks Patrick!