Added assert statements + cleanup