Finished debugging some errors