Started adding tests + the requisite bugfixes that adding tests brings to the table