Subjects will also receive TAU during the course of the study in addition to IV ketamine or midazolam treatment. In the MDD group, TAU may include a newly initiated or longstanding antidepressant. In the BD group, TAU may include a mood stabilizer such as lithium or valproate that is a first or second line agent as per Canadian Network for Mood and Anxiety Treatments (CANMAT) guidelines (Yatham et al., 2013). This is done in an attempt to mitigate the risks of relapse after cessation of ketamine therapy and also makes the use of midazolam treatment ethically justifiable. The duration of the study is two weeks. All subjects will receive all 6 treatments, regardless of whether their symptoms have remitted, given recent evidence that 6 IV ketamine treatments led to a more robust and lasting response compared to only 1-3 treatments (Aan Het Rot et al., 2012). If subjects are discharged before 2 weeks, they will be asked to return to hospital as outpatients for any remaining ketamine treatments as well as for outcome measures at 2-weeks and 42 days. TAU will be maintained after discharge.